import os
import time

dataset_dir='data/js/hynek_dataset'
max_retry=100

now=0

while True:
    try:
        cmd='python mcd_main.py build_ast_robustness {}'
        cmd=cmd.format(dataset_dir)
        result=os.system(cmd)
        
        if result==0: break
        else:
            now+=1
            if now>=max_retry:
                break
        time.sleep(1)
    except KeyboardInterrupt:
        break